package com.gzc.pm.ro;

import java.util.ArrayList;
import java.util.List;

import org.apache.poi.hssf.record.formula.functions.Int;

import com.gzc.pm.bean.EquipmentBean;
import com.gzc.pm.dao.EquipmentDao;

public class EquipmentRo {

	public List<EquipmentBean> getInProcIds(String idsStr){
		EquipmentDao dao = new EquipmentDao();
		return dao.getInProcIds(idsStr);
	}
	
	public String getEquInfoByPlId(List<Integer> _procIdsList){
		EquipmentDao dao = new EquipmentDao();
		String equIdsStr = "";
		for(int i=0; i < _procIdsList.size(); i++){
			List<EquipmentBean> equList = dao.getEquInfoByPlId(_procIdsList.get(i));
			if(equList.size() != 0){
				equIdsStr += equList.get(0).getEquId() + ",";
			}
		}
		equIdsStr += "-1";
		return equIdsStr;
	}
	
	public String getEquIdsStrByEquId(int equId){
		EquipmentDao dao = new EquipmentDao();
		EquipmentBean eBean = dao.getInfoByEquId(equId);
		String equIdsStr = "";
		List<Integer> _procIdsList = new ArrayList<Integer>();
		if(eBean != null){
			_procIdsList.add( eBean.getPrId());
			equIdsStr = getEquInfoByPlId(_procIdsList);
		}
		equIdsStr += "-1";
		return equIdsStr;
	}
	
	
}
